#include<bits/stdc++.h>
using namespace std;

class Solution {
public:
    int totalMoney(int n) {
        int a1_w, a1_d, d_w, d_d, n_w, n_d;//w = week , d = day
        int S_w, S_d;
        a1_w = 28;
        d_w = 7;
        d_d = 1;
        n_w = n / 7;
        n_d = n % 7;
        a1_d = 1 + n_w;
        S_w = n_w * a1_w + (n_w * (n_w - 1)) * d_w / 2;
        S_d = n_d * a1_d + (n_d * (n_d - 1)) * d_d / 2;
        return S_w + S_d;
    }
};

/**
 * 2022.1.15
 * 等差数列应用
 */